require "ttWxCommon"

class MainFrameListViewMgr < ListCtrl
	def initialize(frm,auiMgr)
		@frm=frm
		@auiMgr=auiMgr
		@style=LC_REPORT|LC_VIRTUAL
		super(@frm,ID_ANY,DEFAULT_POSITION,DEFAULT_SIZE,LC_ICON,)
		@pi = AuiPaneInfo.new
		@pi.set_name("ProjectListView")
		@pi.show.set_layer(0).top
		@auiMgr.add_pane(self, @pi)
	end
	def showFiles(elem)
		clear_all()
		getItemCounter(elem)
		p @index
		insert_column(0,"First")
		insert_column(1,"Second")
		insert_column(2,"Third")
        	set_column_width(0,200)
        	set_column_width(1,200)
        	set_column_width(2,200)
#        self.item_count = @index
	end
	def getItemCounter(elem)
		if "file" == elem.name then
			name = elem.attributes["name"]
			if name then
				@index = @index + 1
			end
		end
		elem.each_element do |element|
			getItemCounter(element)
		end
	end
# Normally you would determine the text, attributes and/or image
# based on values from some external data source, but for this demo
# we'll just calculate them based on order. 
    def on_get_item_text(item, col)
		p "on_get_item_text"
		return "Item %d, column %d" % [item,col]
    end
    
    def on_get_item_column_image(item, col)
		p "on_get_item_column_image"
        return -1
    end
    def on_get_item_attr(item)
		p "on_get_item_attr"
        return @attr1
    end
end
